<template>
  <a-card>
    <template #title>
      <div class="section-title">
        <span>立即预审</span>
        <a-tag color="warning">等待中</a-tag>
      </div>
    </template>

    <!-- 案件基本信息 -->
    <div class="case-basic-info" style="margin-bottom: 24px;">
      <a-descriptions title="案件基本信息" :column="2" bordered>
        <a-descriptions-item label="批次名称">{{ caseData.batchName }}</a-descriptions-item>
        <a-descriptions-item label="委案商">{{ caseData.entrustBName }}</a-descriptions-item>
        <a-descriptions-item label="审核文件">
          <a-button type="link" v-if="caseData.auditFile" @click="downloadFile(caseData.auditFile)">
            下载审核文件
          </a-button>
          <span v-else>暂无文件</span>
        </a-descriptions-item>
        <a-descriptions-item label="审核结果">
          <a-tag :color="caseData.auditResult === 'approved' ? 'success' : 'error'">
            {{ caseData.auditResult === 'approved' ? '通过' : '拒绝' }}
          </a-tag>
        </a-descriptions-item>
        <a-descriptions-item label="审核摘要" :span="2">
          {{ caseData.auditSummary || '暂无摘要' }}
        </a-descriptions-item>
      </a-descriptions>
    </div>

    <div class="action-buttons" style="text-align: center;">
      <a-button type="primary" @click="showCaseDetailModal">
        详情
      </a-button>
    </div>
  </a-card>
</template>

<script setup lang="ts">
import { defineProps, defineEmits } from 'vue';

// 定义属性
defineProps<{
  caseData: any;
}>();

// 定义事件
const emit = defineEmits(['show-case-detail-modal', 'download-file']);

// 显示案件详情弹框
const showCaseDetailModal = () => {
  emit('show-case-detail-modal');
};

// 下载文件
const downloadFile = (fileUrl: string) => {
  emit('download-file', fileUrl);
};
</script>

<style scoped>
.section-title {
  display: flex;
  align-items: center;
  gap: 8px;
}
</style>
